@extends('admin::layouts.master')
@section('content')
    <form action="/admin/role/permission/{{$role['id']}}" method="POST">
        @csrf
        <div class="x_panel">
            <div class="x_title">
                <h2>[<span style="color:red;"> {{$role['title']}} </span>] 权限配置</h2>
                <div class="clearfix"></div>
            </div>
            @foreach($modules as $module)
                <div class="form-group">
                    <div class="col-md-9 col-sm-9 col-xs-12">
                        @foreach($module['rules'] as $rule)
                            <div class="checkbox">
                                <p class="lead">{{$rule['group']}}</p>
                                @foreach($rule['permissions'] as $permission)
                                    <label class="inline">
                                        <input name="name[]" {{$role->hasPermissionTo($permission['name']) ? 'checked=""' : ''}} type="checkbox" value="{{$permission['name']}}" class="flat"> {{$permission['title']}}
                                    </label>
                                @endforeach
                            </div>
                        @endforeach
                    </div>
                </div>
            @endforeach
        </div>
        <button class="btn btn-primary">提交</button>
    </form>
@endsection
